using System.ComponentModel.DataAnnotations.Schema;

namespace Wips.Domain.Models.Authorities.Model
{
    /// <summary>
    /// 角色与权限关联
    /// </summary>
    [Table("AuthorityRolePermissions")]
    [SugarTable("AuthorityRolePermissions")]
    public class RolePermission : ValueObjectBase
    {
        /// <summary>
        /// 角色ID
        /// </summary>
        /// <value></value>
        public string RoleId { get; set; }

        /// <summary>
        /// 角色
        /// </summary>
        /// <value></value>
        [Navigate(NavigateType.ManyToOne, nameof(RoleId))]
        public Role Role { get; set; }

        /// <summary>
        /// 权限ID
        /// </summary>
        /// <value></value>
        public string PermissionId { get; set; }

        /// <summary>
        /// 权限
        /// </summary>
        /// <value></value>
        [Navigate(NavigateType.ManyToOne, nameof(Permission))]
        public Permission Permission { get; set; }




        /// <summary>
        /// 
        /// </summary>
        public RolePermission()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="permissionId"></param>
        /// <param name="applicationId"></param>
        /// <exception cref="ArgumentNullException"></exception>
        public RolePermission(string roleId, string permissionId)
        {
            RoleId = roleId ?? throw new ArgumentNullException(nameof(roleId));
            PermissionId = permissionId ?? throw new ArgumentNullException(nameof(permissionId));
        }
    }
}